package analyse;

import java.math.BigDecimal;
import java.util.List;

import org.hibernate.Query;

import spring.SpringApplicationCtx;

import com.stock.StockQuery;
import com.stock.dao.Averline;

import data.DataBuffer;

public class AverAnlyz {
	public AverAnlyz() {
		StockQuery stockQuery = (StockQuery) SpringApplicationCtx.getCtx().getBean("StockQuery");
		List<String> codeset = stockQuery.getAll("select number from Stockanlyz");
		String sql = "from Stockdaydeal where number=:number order by dealDay desc";
		for (String code : codeset) {
			Query query = stockQuery.getCurrentSession().createQuery(sql);
			List<Averline> avers = query.setMaxResults(5).setString("number", code).list();
			BigDecimal last30Price = BigDecimal.ZERO;
			BigDecimal last20Price = BigDecimal.ZERO;
			BigDecimal last10Price = BigDecimal.ZERO;
			for (Averline averline : avers) {
				if(last30Price.compareTo(BigDecimal.ZERO)>0){
					if(averline.getAver30().compareTo(last30Price)>0){
//						DataBuffer.getUpline().add(code);
					}else if(averline.getAver30().compareTo(last30Price)==0){
						
					}
				}
			}
		}
	}
}
